<?php
//验证码
session_start();
if(!isset($_SESSION["authnum_session"])){
   echo "0||系统错误,请稍后再试！";
   exit;
}
if(strtolower($_SESSION["authnum_session"])!=strtolower($_POST["validate"])){
    session_destroy();//销毁验证码
   echo "0||验证码错误！";
   exit;
}
//保存数据
include("config/config.php");
$count = $dbh->exec("INSERT INTO apply_data SET name='".$_POST['name']."' ,phone='".$_POST['phone']."',email='".$_POST['email']."',wechat='".$_POST['wechat']."' ,destination='".$_POST['destination']."' ,time=NOW()");
if($count){
    echo "1||已收到您的信息，我们稍后将尽快与您联系，感谢您对我们的支持！";
}
else{
    $error_message=$dbh->errorInfo();
    $logfile=fopen("log/log.log","a+");
    fwrite($logfile,$function.":".$error_message[2]."----".date("y-m-d H:i:s",time())."\r\n");
    fclose($logfile);
    echo "0||请求超时，请您稍后再试！";
}
